<template>
  <view class="new-file">   
    <!-- 第二种方法 -->
    <view class="head-nav">
      <!-- 头部选项卡 -->
     <view :class="listIndex==index?'activite':''" @click="checkListIndex(index)" v-for="(item,index) in navList" :key="index">{{item.name}}</view>
    </view>
    <!-- 内容 -->
    <view class="content">
       <view class="" v-if="listIndex==0">
         0
       </view>
			 <view class="" v-if="listIndex==1">
			   1
			 </view>
    </view>
    
    
    
  </view>
  
</template>

<script>
  export default{
    data(){
      return{
        navList:[{name:"选项卡一",id:'1'},{name:"选项卡二",id:'2'}],
        listIndex:0
      }
    },
    methods:{
      checkListIndex(index){
        this.listIndex=index;
      }
    }
  }
</script>

<style scoped>
  .head-nav{
    width: 50%;
    margin:20rpx auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .activite{
    font-weight: bold;
    border-bottom: 6rpx solid #0065d9;
  }
  .head-nav>view{
    padding-bottom: 10rpx;
  }
  .box{background: #008000;}
</style>